package 多线程初阶.示例测试;
/**
 * 观察标志位是否清除
 */
public class TestDemo7 {
        private static class MyRunnable implements Runnable {
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    System.out.println(Thread.currentThread().isInterrupted());
                }
            }
        }
        public static void main(String[] args) {
            MyRunnable target=new MyRunnable();
            Thread thread=new Thread(target);
            thread.start();
            thread.interrupt();//可以认为是拉下开关
        }
    }
